package com.feature.shop.user.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.feature.core.domain.PageVo;
import com.feature.core.mybatis.BaseService;
import com.feature.core.mybatis.SmartBaseMapper;
import com.feature.shop.user.api.request.ShopFileUploadRecordListRequest;
import com.feature.shop.user.api.request.ShopFileUploadRecordPageRequest;
import com.feature.shop.user.api.vo.ShopFileUploadRecordVo;
import com.feature.shop.user.mapper.ShopFileUploadRecordMapper;
import com.feature.shop.user.converter.ShopFileUploadRecordConverter;
import com.feature.shop.user.model.entity.ShopFileUploadRecordEntity;

/***
 *文件上传记录Service
 */
@Service
public class ShopFileUploadRecordService extends BaseService<ShopFileUploadRecordEntity> {
    @Autowired
    private ShopFileUploadRecordMapper shopFileUploadRecordMapper;

    @Autowired
    private ShopFileUploadRecordConverter shopFileUploadRecordConverter;

    @Override
    public SmartBaseMapper<ShopFileUploadRecordEntity> getSmartBaseMapper() {
        return shopFileUploadRecordMapper;
    }

    public PageVo<ShopFileUploadRecordVo> findPageList(ShopFileUploadRecordPageRequest req) {
        PageVo<ShopFileUploadRecordEntity> pageData = shopFileUploadRecordMapper.selectPageList(req.getCurPage(), req.getPageSize(), shopFileUploadRecordConverter.pageRequestToQuery(req));
		PageVo<ShopFileUploadRecordVo> vo = PageVo.of(pageData, shopFileUploadRecordConverter::entityListToVO);
		return vo;

    }

    public List<ShopFileUploadRecordVo> findList(ShopFileUploadRecordListRequest req) {
        List<ShopFileUploadRecordEntity> list = shopFileUploadRecordMapper.selectList(shopFileUploadRecordConverter.listRequestToQuery(req));
        return shopFileUploadRecordConverter.entityListToVO(list);
    }
    
    @Override
	public Class<ShopFileUploadRecordEntity> getEntityClass() {
		return ShopFileUploadRecordEntity.class;
	}

}
